﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleMapperTest
{
    /// <summary>
    /// Provides data required for Test methods
    /// </summary>
    public class TestData
    {

        /// <summary>
        /// Returns a list of employees
        /// </summary>
        /// <returns>List of Employee</returns>
        public static List<Employee> GetMockListOfEmployee()
        {
            List<Employee> employees = new List<Employee>();
            Employee emp1 = GetMockEmployee();
            Employee emp2 = GetMockEmployee(1010, "Rajiv", "New Delhi", "+919456312345");
            employees.Add(emp1);
            employees.Add(emp2);
            return employees;
        }

        /// <summary>
        /// Returns an employee
        /// </summary>
        /// <returns>Employee</returns>
        public static Employee GetMockEmployee()
        {
            Employee employee = new Employee { 
             EmployeeId=1001, 
             Name="John", 
             Phone="914561245563", 
             Address="SP Road", 
             DateOfBirth=DateTime.Parse("07/22/1970"), 
             DateOfJoin=DateTime.Now, 
             Department=GetMockDepartment(), 
             Designation=GetMockDesignation(),
             DesignationId = 1,
             EmployeeSkills = GetMockEmployeeSkills()
            };
            return employee;
        }

        public static Employee GetMockEmployee(int empId, string empName, string empAddress, string empPhone)
        {
            Employee employee = new Employee
            {
                EmployeeId = empId,
                Name = empName,
                Phone = empPhone,
                Address = empAddress,
                DateOfBirth = DateTime.Parse("07/22/1970"),
                DateOfJoin = DateTime.Now,
                Department = GetMockDepartment(),
                Designation = GetMockDesignation(),
                DesignationId = 1,
                EmployeeSkills = GetMockEmployeeSkills()
            };
            return employee;
        }


        /// <summary>
        /// Returns Designation
        /// </summary>
        /// <returns>Designation</returns>
        public static Designation GetMockDesignation()
        {
            return new Designation { DesignationId = 1, DesignationName = "Consultant" };
        }
        
        /// <summary>
        /// Returns Department
        /// </summary>
        /// <returns>Department</returns>
        public static Department GetMockDepartment()
        {
            return new Department { DepartmentId = 1, DepartmentName = "IT" };
        }
        
        /// <summary>
        /// Returns a list of EmployeeSkill 
        /// </summary>
        /// <returns></returns>
        public static List<EmployeeSkill> GetMockEmployeeSkills()
        {
            List<EmployeeSkill> employeeSkills = new List<EmployeeSkill>();
            EmployeeSkill employeeSkill = new EmployeeSkill{
                EmployeeId=1001, EmployeeSkillId=1, SkillId=1, SkillUsedMonths=3
            };
            employeeSkills.Add(employeeSkill);

            return employeeSkills;
        }
    }

    public class Employee
    {
        public Employee()
        {
            EmployeeSkills = new HashSet<EmployeeSkill>();
        }
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }
        public string Phone { get; set; }
        public System.DateTime DateOfBirth { get; set; }
        public System.DateTime DateOfJoin { get; set; }
        public int DesignationId { get; set; }
        public byte[] RowId { get; set; }
        public virtual Designation Designation { get; set; }

        public virtual Department Department { get; set; }

        public virtual ICollection<EmployeeSkill> EmployeeSkills { get; set; }

    }

    public class Designation
    {
        public int DesignationId { get; set; }
        public string DesignationName { get; set; }
     
    }

    public class Department
    {
        public int DepartmentId { get; set; }
        public string DepartmentName { get; set; }        
    }

    public class Skill
    {
        public int SkillId { get; set; }
        public string SkillName { get; set; }    
    
    }

    public class EmployeeSkill
    {
        public int EmployeeSkillId { get; set; }
        public int SkillId { get; set; }
        public int EmployeeId { get; set; }
        public int SkillUsedMonths { get; set; }
    }


    public class EmployeeDto
    {
        public int EmployeeId { get; set; }
        public string Name { get; set; }
        public string Address { get; set; }
        public string Phone { get; set; }
        public System.DateTime DateOfBirth { get; set; }
        public System.DateTime DateOfJoin { get; set; }
        public int DesignationId { get; set; }
        public virtual Designation Designation { get; set; }
        public virtual Department Department { get; set; }

    }

}
